<center>

지원이 중단되었습니다: 이 기능은 더 이상 권장되지 않습니다. 일부 브라우저에서는 아직 지원할 수 있지만 관련 웹 표준에서 이미 제거되었거나 제거 과정에 있는 경우가 있으며, 호환성을 위해 유지되고 있을 수 있습니다. 사용을 피하고 가능하다면 기존 코드를 업데이트하세요. 결정을 지원할 하단의 호환성 표를 확인하세요. 이 기능은 언제든지 작동을 중단할 수 있음을 유의하세요.

개요

이 HTML Center (<center>)요소는 또다른 블록요소을 포함하거나, 인라인요소(Inline)를 포함할 수 있는 블록속성(block-level) 의 요소이다. 그리고 해당 <center> 요소안에 포함된 전체요소는 <center>의 내용안에 가운데 정렬이 된다. (통상적으로 <body>로 쓰임).

이 태그는 HTML4(또는 XHTML 1)이후에는 잘사용되지 않고, CSS의 text-align 속성이 즐겨 사용된다. <div> 요소나 <p>요소 같은 블록속성이 있는 요소에 사용될 수 있다.또 다른 방법으로는 CSS속성을 사용하여 margin-left 또는 margin-right 또는 margin을 자동(Css("margin") 를 0 auto)으로 설정한다.

DOM 인터페이스

이 요소는 HTMLElement 인터페이스를 구현합니다.

참고: Implementation note: up to Gecko 1.9.2 inclusive, Firefox implements the HTMLSpanElement interface for this element.

예제 1

html
<center>
  This text will be centered.
  <p>So will this paragraph.</p>
</center>

예제 2 (CSS 대안)

html
<div style="text-align:center">
  This text will be centered.
  <p>So will this paragraph.</p>
</div>

예제 3 (CSS 대안)

html
<p style="text-align:center">
  This line will be centered.<br />
  And so will this line.
</p>

메모

Applying text-align:center to a <div> or <p> element centers the contents of those elements while leaving their overall dimensions unchanged.

더 보기